Hazel: Run ./configure in a build rule #858
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some Hackage packages ship with a
./configure
script that they require to be run. Hazel used to run this script within the repository rule that sets up the package. In a way this makes sense, repository rules are meant for the configure stage. However, this made it very hard to control what environment the./configure
script would pick up. In particular, it might pick up a different C compiler and set of system libraries than the Bazel build would use later on, e.g.nixpkgs_cc_toolchain
or the mingw toolchain included in the GHC bindist on Windows.This change moves the
./configure
step from the repository rule to a dedicated build rule. This immediately allows to build some packages on Windows that previously required custom build definitions. E.g.unix-time
andnetwork
. Note,network
still requires some minor patching. The reason is thatnetwork
relies on abuildinfo
file, which is generated by./configure
and meant to be patched into thepackageDescription
determined by the cabal file. This can be worked around by instead patching the cabal file to conditionally define the corresponding fields depending on the OS.This also adds
network
to the Windows CI.See also FormationAI/hazel#80